﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RooHui.Infrastructure.Entities.Repository;

namespace RooHui.Infrastructure.Entities.Entity
{
    public class Province: IAccessible<P_Province, Province>, ILogicEntity<P_Province, Province>
    {
        public string ProvinceCode { get; set; }

        public string ProvinceName { get; set; }

        protected override void Covariant(P_Province model)
        {
            if (model != null)
            {
                this.ProvinceCode = model.ProvinceCode;
                this.ProvinceName = model.ProvinceName; 
            }
        }

        protected override P_Province Inverter(Province model)
        {
            if (model != null)
            {
                return new P_Province()
                {
                    ProvinceCode = model.ProvinceCode,
                    ProvinceName = model.ProvinceName 
                };
            }
            return null;
        }

        public Province Set(P_Province dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
